const fs = require('fs')
const path = require('path')

// 加载当前文件夹下的所有中间件
const files = fs.readdirSync(__dirname)
global.middleware = {}
files.forEach((file) => {
  if (file === 'index.js') {
    return
  }
  const middleware = require(path.join(__dirname, file))
  for(let key in middleware){
    global.middleware[key] = middleware[key]
  }
})